<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
</head>
<body>
    <form id="student-add-form" class="form-horizontal">
        <div>
            <p class="bg-primary">注意：年级格式为 2019；班级格式为 1班 2班</p>
        </div>
        <div class="form-group">
            <label for="code" class="col-sm-2 control-label">学号</label>
            <div class="col-sm-10">
                <input type="text" class="form-control" id="code" />
            </div>
        </div>
        <div class="form-group">
            <label for="sname" class="col-sm-2 control-label">姓名</label>
            <div class="col-sm-10">
                <input type="text" class="form-control" id="sname" />
            </div>
        </div>

        <div class="form-group">
            <label for="grade" class="col-sm-2 control-label">学年</label>
            <div class="col-sm-10">
                <input th:disabled="${className!=null}" th:value="${className==null?'':className[0]}" type="text" class="form-control" id="grade" />
            </div>
        </div>
        <div class="form-group">
            <label for="major" class="col-sm-2 control-label">专业</label>
            <div class="col-sm-10">
                <input  th:value="${className!=null?className[1]:''}" th:disabled="${className!=null}" type="text" list="student-major" class="form-control" id="major" />
                <th:block th:if="${className==null}">
                    <datalist  id="student-major">
                        <th:block th:if="${className==null}">
                            <option th:each="major:${majors}" th:value="${major}" th:text="${major}"></option>
                        </th:block>
                    </datalist>
                </th:block>
            </div>
        </div>
        <div class="form-group">
            <label for="class_no" class="col-sm-2 control-label">班级</label>
            <div class="col-sm-10">
                <input th:disabled="${className!=null}" th:value="${className==null?'':className[2]}" type="text" class="form-control" id="class_no" />
            </div>
        </div>
    </form>
</body>
</html>